package com.powernode.dispatch.handler;

import com.powernode.dispatch.service.NewOrderService;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * xxl-job 任务处理类
 */
@Component
public class JobHandler {
    @Resource
    private NewOrderService newOrderService;

    @XxlJob("newOrderTaskHandler")
    public void newOrderTaskHandler() {
        //获取jobId
        long jobId = XxlJobHelper.getJobId();
        //执行任务
        newOrderService.executeTask(jobId);
    }
}
